package com.adu.adusharding.util;

import java.util.List;

/**
 * 返回对象
 */
//@SuppressWarnings({"rawtypes"})
public class JsonResult<T> {
    public static <T> Result OK(int code, String message, T data) {
        Result result = new Result();
        result.code = code;
        result.message = message;
        result.data = data;
        return result;
    }

    public static <T> Result OK(int code, String message, List<T> data) {
        PageInfo page = new PageInfo<T>(data);
        Result result = new Result();
        result.code = code;
        result.message = message;
        result.data = page;
        return result;
    }

    public static <T> Result OK(int code, String message) {
        Result result = new Result();
        result.code = code;
        result.message = message;
        return result;
    }

    public static <T> Result OK(List<T> data) {
        Result result = new Result();
        result.code = 200;
        result.message = "success";
        result.data = data;
        return result;
    }

}